
#include "programme.h"
#include "mytestsuite.h"


int main(int argc, char **argv) {
  
 
  
  
	if(argc==1)
	{
		cout<<endl<<"Erreur de syntaxe, rappel ./lobo [-c][-s] file.lobo"<<endl<<endl<<"	-c : compile genarated .cpp (with gcc)"<<endl<<"	-s : silent mod"<<endl<<endl;
		//return 0;	
	}
	else
	{
		if(argc==2)
		{
			programme pTest(argv[1]);
			pTest.parser();
			pTest.translate();
		}
		else
		{
			string option1=argv[1];
			
			if(argc==3) 
			{
				if (option1=="-c")
				{
					programme pTest(argv[2]);
					pTest.parser();
					programmecpp X = pTest.translate();
					X.compile();
					return 0;
				}
				if (option1=="-s")
				{
					programme pTest(argv[2],true);
					pTest.parser();
					pTest.translate();
					return 0;
				}
				else
				{
					cout<<endl<<"Erreur de syntaxe, rappel ./lobo [-c][-s] file.lobo"<<endl<<endl<<"	-c : compile genarated .cpp (with gcc)"<<endl<<"	-s : silent mod"<<endl<<endl;
					return 0;
				}
			}
			if(argc==4)
			{
				string option2=argv[2];
				
				if((option1=="-c" && option2=="-s")||(option1=="-s" && option2=="-c"))
				{
					programme pTest(argv[3],true);
					pTest.parser();
					programmecpp X = pTest.translate();
					X.compile();
				}
				else
				{
					cout<<endl<<"Erreur de syntaxe, rappel ./lobo [-c][-s] file.lobo"<<endl<<endl<<"	-c : compile genarated .cpp (with gcc)"<<endl<<"	-s : silent mod"<<endl<<endl;
				
					return 0;
				}
			}
			else
			{
				cout<<endl<<"Erreur de syntaxe, rappel ./lobo [-c][-s] file.lobo"<<endl<<endl<<"	-c : compile genarated .cpp (with gcc)"<<endl<<"	-s : silent mod"<<endl<<endl;
			
				return 0;
			}
		}
	}
	
	 /* Section de tests */
	
       for(int i=0;i<5;i++)
	{
		mytestsuite Test;
		Test.testInstruction(i);
	}

  
	
	
	/*-------------------*/
	return 0;
}